package com.cmower.baeldung.hashmap1;

import org.checkerframework.checker.units.qual.K;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class HashMapDemo {
    public static void main(String[] args) {
        HashMap<String,Integer> map = new HashMap<>();

        int h;
        String key ="wanger";
        h = key.hashCode();
        int l = h >>> 16;
        //>>>    :     无符号右移，忽略符号位，空位都以0补齐

        int hash = h ^ l;
        // a % b == a & (b - 1)


        String [] keys = {"沉","默","王","二"};
        for (String k : keys) {
            int h1 = k.hashCode();
            int l1 = h1 >>> 16;
            int hash1 = h1 ^ l1;

            System.out.println(hash1);

            int i = (16 - 1) & hash1;
            System.out.println(i);
        }

        map.put("1", 1);
        map.put("2", 2);
        map.put("3", 3);
        map.put("4", 4);
    }
}
